'''
@Company: TWL
@Author: xue jian
@Email: xuejian@kanzhun.com
@Date: 2020-05-22 10:18:21
'''
import random, os
import sys
def cut_data(num, path, dates, write_path):
    for date in dates:
        print(date)
        if not os.path.exists(write_path + date):
            os.mkdir(write_path + date)
        cut_files = []
        for i in range(num):
            cut_files.append(open(write_path + date + "/" + str(i), 'wb'))
        f = open(path + date, 'rb')
        count = 0
        for line in f:
            tmp_num = count//10000 % num
            cut_files[tmp_num].write(line)
            count += 1

dates = []
dates.extend('2020-04-' + str(i) for i in range(11, 31))
dates.extend('2020-05-0' + str(i) for i in range(1, 10))

print(dates)
cut_data(6, "/data3/training_data/arc_six/bossrec_success_fid_flow/", dates,  "/data3/training_data/arc_six/bossrec_success_fid_flow_cut/")